package com.school.empsys.constants;

/**
 * 用户状态
 */
public enum UserStatus {

    INVALID(0, "INVALID", "无效"),
    VALID(1, "VALID", "有效"),
    LOCKED(2, "LOCKED", "锁定"),
//    DELETED(3, "DELETED", "已删除"),
    ;

    private Integer code;
    private String name;
    private String displayName;

    UserStatus(Integer code, String name, String displayName) {
        this.code = code;
        this.name = name;
        this.displayName = displayName;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    /**
     * 由String转到枚举值
     *
     * @return
     */
    public static AttendanceStatus fromString(String value) {
        for (AttendanceStatus certType : AttendanceStatus.values()) {
            if (certType.getCode().toString().equals(value)) {
                return certType;
            }
        }
        return null;
    }

}
